package com.longdaji.decoration.ui.bannerImage;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.longdaji.decoration.R;
import com.longdaji.decoration.base.BaseActivity;
import com.longdaji.decoration.ui.buildinfo.BuildInfoContract;
import com.longdaji.decoration.utils.ImageUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by longtao on 2017/12/19.
 */

public class BannerImageActivity extends BaseActivity implements BuildInfoContract.View {

    private static final String TAG = BannerImageActivity.class.getSimpleName();
    @BindView(R.id.tv_title)
    TextView mTvTitle;
    @BindView(R.id.iv_banner_image)
    ImageView mBannerImage;
    private String mImageAddress;


    public static Intent getStartIntent(Context context) {
        Intent intent = new Intent(context, BannerImageActivity.class);
        return intent;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "BannerImageActivity onCreate");
        setContentView(R.layout.activity_banner_image);
        setUnBinder(ButterKnife.bind(this));
        initView();
    }

    private void initView() {

        if (getIntent() != null) {
            mImageAddress = getIntent().getStringExtra("image");
            mTvTitle.setText(getIntent().getStringExtra("title"));
        }
        Log.d(TAG, "BannerImageActivity mImageAddress=" + mImageAddress);
        ImageUtil.loadImage(this.getApplicationContext(),mImageAddress,mBannerImage);
//        Glide.with(this.getApplicationContext())
//                .load(mImageAddress)
//               // .thumbnail(0.3f)
//                .centerCrop()
//                //.placeholder(R.drawable.no_banner)
//                .error(R.drawable.no_banner)
//                .into(mBannerImage);
        // GlideUtils.loadImage(this, mImageAddress, mBannerImage, null, R.drawable.no_banner, R.drawable.no_banner);

    }


    @OnClick({R.id.iv_back})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            default:
                break;
        }
    }
}
